home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13058 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  46 lines

  1. Path: hoho.quake.net!usenet
  2. From: billf@jovial.com (Bill Foote)
  3. Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.beta,comp.lang.java,comp.lang.sather
  4. Subject: Re: What Should An Exception Handling Do? -- Clarification of rules
  5. Date: 23 Mar 1996 05:55:47 GMT
  6. Organization: Jovial
  7. Message-ID: <4j03p4$fbt@hoho.quake.net>
  8. References: <1996Mar14.155641.4299@schbbs.mot.com> <4irn11$7ln@mimas.brunel.ac.uk> <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>
  9. NNTP-Posting-Host: l89.ip.quake.net
  10.  
  11. In article <Pine.Sola.3.91.960322041345.17711C-100000@ux5.cso.uiuc.edu>,
  12. Matthew Travis  <mtravis@students.uiuc.edu> wrote:
  13. >H'llo,
  14. >    for clarification, Java uses the same exception handling 
  15. >mechanism as C++ (with the addition of the finally clause). The two 
  16. >possible mechanisms are "resumption" and "termination". A quote from the  
  17. >"Annotated C++ Reference Manual" states:
  18. >
  19. >    "Exception handling is intended to allow code that has encountered 
  20. >a condition it cannot cope with to return to some other code that 
  21. >directly or indirectly invoked it. There is no way for an exception 
  22. >handler to request the thread of control to resume from the throw point. 
  23. >In other words, "throw" implements the termination model of exception 
  24. >handling."     -ARM, Ellis & Stroustrup, page 354
  25. >
  26. >This model has been accepted into the draft C++ standard and is also the 
  27. >model Java uses. The philosophy is that an exception indicates some error 
  28. >condition that is usually unrecoverable and code that is in error should 
  29. >terminate (thinking about it logically).
  30.  
  31. A cynic might conclude something more along these lines:  "It would be hard
  32. to implement resumable exceptions in C++, so they decided to punt."
  33.  
  34. It's not too hard to come up with examples where it would be nice to have
  35. resumable exceptions.  One example is resource acquisition.  Upon failure
  36. to acquire a resource (a file descriptor, some memory, etc.) it might be
  37. nice if a top-level exception handler could try to free up some resources,
  38. and if it can, try to resume from the exception.
  39.  
  40.  
  41. Oh well.
  42. --
  43. Bill Foote                       |  L'homme est nΘ pour vivre dans les
  44. billf@jovial.com                 |  convulsions de l'inquiΘtude ou dans la
  45. http://www.jovial.com/~billf/    |  lΘthargie de l'ennui       -- Voltaire
  46.